<?php
//开启会话
session_start();
//验证用户输入的用户名和密码是否正确
//连接数据库服务器
include_once 'conn.php';

//读取用户填写的用户名和密码
$username = trim($_POST['username']);
$password = md5(trim($_POST['password']));

//判断用户名和密码是否正确
$sql = "select * from userinfo where username='$username' and password='$password'";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result)){
    echo "<script>alert('登录成功！');</script>";
}else{
    echo "<script>alert('用户名或(和)密码错误！');</script>";
}